package com.qrpay.model.enums;

/**
 * 币种
 */
public enum CurrencyType {

    CNY("CNY", "人民币"),
    USD("USD", "美元"),
    SGD("SGD", "新加坡元"),
    AUD("AUD", "澳元"),
    MYR("MYR", "马来币"),
    VND("VND", "越南盾"),
    THB("THB", "泰铢"),
    IDR("IDR", "印尼盾"),
    
    // TODO

    ;

    private final String code;
    private final String desc;

    CurrencyType(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public boolean equals(String code) {
        return this.code.equals(code);
    }

    public static CurrencyType byCode(String code) {
        for (CurrencyType t : values()) {
            if (t.equals(code)) return t;
        }
        return null;
    }
}
